package com.example.bookshop.service.impl;

import com.example.bookshop.entity.Book;
import com.example.bookshop.mapper.BookMapper;
import com.example.bookshop.service.AdminService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @auth shanyue
 * @date 2025年06月05日15:09
 */
@Service
public class AdminServiceImpl implements AdminService {

    @Resource
    private BookMapper bookMapper;

    @Override
    public List<Book> searchBooks(String keyword, int offset, int size) {
        return bookMapper.searchBooks(keyword, offset, size);
    }

    @Override
    public int countBooks(String keyword) {
        return bookMapper.countBooks(keyword);
    }

    @Override
    public void insert(Book book) {
        bookMapper.insert(book);
    }

    @Override
    public void updateBook(Book book) {
        bookMapper.updateBook(book);
    }

    @Override
    public void deleteById(Integer id) {
        bookMapper.deleteById(id);
    }

}
